package prototype.deepclone;

import java.io.Serializable;

/**
 * Created by IntelliJ
 * Author:熊磊
 */
public class DeepSheep implements Serializable,Cloneable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private String cloneName;

    private String cloneClass;

    //构造器
    public DeepSheep(String cloneName, String cloneClass) {
        System.out.println("深拷贝羊："+cloneName+"创建成功");
        this.cloneName = cloneName;
        this.cloneClass = cloneClass;
    }

    //因为该类的属性，都是String , 因此我们这里使用默认的clone完成即可
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public String toString() {
        return "DeepSheep{" +
                "cloneName='" + cloneName + '\'' +
                ", cloneClass='" + cloneClass + '\'' +
                '}';
    }

    public String getCloneName() {
        return cloneName;
    }

    public String getCloneClass() {
        return cloneClass;
    }
}
